It has been known in the past to arrange a catalyst able to store oxygen in an exhaust passage of an internal combustion engine and remove unburned gas (HC, CO, etc.) and NOX in the exhaust gas at the catalyst. The higher the oxygen storage ability of the catalyst, the greater the amount of oxygen which can be stored in the catalyst and the better the exhaust purification performance of the catalyst.
To maintain the oxygen storage ability of the catalyst, the oxygen storage amount of the catalyst preferably is made to fluctuate so that the oxygen storage amount of the catalyst is not maintained constant. In the internal combustion engine described in PTL 1, to make the oxygen storage amount of the catalyst fluctuate, the target air-fuel ratio of the exhaust gas flowing into the catalyst is alternately switched between a lean air-fuel ratio leaner than a stoichiometric air-fuel ratio and a rich air-fuel ratio richer than the stoichiometric air-fuel ratio. Specifically, when the air-fuel ratio detected by the downstream side air-fuel ratio sensor becomes a rich judged air-fuel ratio richer than the stoichiometric air-fuel ratio or becomes less, the target air-fuel ratio is switched from the rich air-fuel ratio to the lean air-fuel ratio, while when the estimated value of the amount of oxygen stored at the catalyst becomes a switching reference value or more while the target air-fuel ratio is maintained at the lean air-fuel ratio, the target air-fuel ratio is switched from the lean air-fuel ratio to the rich air-fuel ratio.
Further, if such control is performed, an air-fuel ratio-related parameter is corrected by learning control so as to keep the exhaust emission from deteriorating due to deviation of the output value of the upstream side air-fuel ratio sensor. Specifically, the oxygen storage value, which is the estimated value of the amount of oxygen stored at the catalyst while the target air-fuel ratio is maintained at the lean air-fuel ratio, and the oxygen discharge amount, which is the estimated value of the amount of oxygen discharged from the catalyst while the target air-fuel ratio is maintained at the rich air-fuel ratio, are calculated, the learning value is updated based on a difference between the oxygen storage amount and the oxygen discharge amount, and the air-fuel ratio-related parameter is corrected based on the learning value so that the difference between the oxygen storage amount and the oxygen discharge amount becomes smaller.